# 使用Windows TTS生成语音文件
# 需要安装 ffmpeg 才能转换为MP3格式

Add-Type -AssemblyName System.Speech

$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer
$speak.Rate = 0
$speak.Volume = 100

# 设置输出目录
$voiceDir = "$PSScriptRoot\voice"
if (-not (Test-Path $voiceDir)) {
    New-Item -ItemType Directory -Path $voiceDir -Force
}

# 生成语音文件（WAV格式）
Write-Host "生成语音文件..."

# 签到成功
$speak.SetOutputToWaveFile("$voiceDir\checkin_success.wav")
$speak.Speak("签到成功")
Write-Host "✓ 生成 checkin_success.wav"

# 结束签到
$speak.SetOutputToWaveFile("$voiceDir\checkin_end.wav")
$speak.Speak("结束签到")
Write-Host "✓ 生成 checkin_end.wav"

$speak.Dispose()

Write-Host ""
Write-Host "语音文件已生成到: $voiceDir"
Write-Host ""
Write-Host "注意：生成的是WAV格式文件"
Write-Host "如果需要MP3格式，请使用在线转换工具或ffmpeg："
Write-Host "  ffmpeg -i checkin_success.wav checkin_success.mp3"
Write-Host "  ffmpeg -i checkin_end.wav checkin_end.mp3"

